package com.company;

public class L_Employee {
    private String name;    //姓名
    private int age;    //年龄
    private String phone;    //联系电话
    private String address;    //家庭住址
    public String getName()
    {
        return name;
    }
    public void setName(String name)
    {
        this.name=name;
    }
    public int getAge()
    {
        return age;
    }
    public void setAge(int age)
    {
        //对年龄进行限制
        if(age<18||age>40)
        {
            System.out.println("年龄必须在18到40之间！");
            this.age=20;    //默认年龄
        }
        else
        {
            this.age=age;
        }
    }
    public String getPhone()
    {
        return phone;
    }
    public void setPhone(String phone)
    {
        this.phone=phone;
    }
    public String getAddress()
    {
        return address;
    }
    public void setAddress(String address)
    {
        this.address=address;
    }
}
